

function MyCkPlayer(id, videoResourceUrl, keyFrames)
{
    this.progressTime = 0;
    this.keyFrames = keyFrames;
    this.videoContainerId = id;
    this.videoObject = {
        //playerID:'ckplayer01',//播放器ID，第一个字符不能是数字，用来在使用多个播放器时监听到的函数将在所有参数最后添加一个参数用来获取播放器的内容
        container: '#'+id, //容器的ID或className
        variable: 'player', //播放函数名称
        loaded: this.loadedHandler, //当播放器加载后执行的函数
        loop: false, //播放结束是否循环播放
        autoplay: true, //是否自动播放
        //loaded:this.loadedHandler,
        //duration: 500, //设置视频总时间
        //cktrack: 'material/srt.srt', //字幕文件
        //poster: 'material/poster.jpg', //封面图片
        //preview: { //预览图片
            //file: ['material/mydream_en1800_1010_01.png', 'material/mydream_en1800_1010_02.png'],
            //scale: 2
        //},
        config: '', //指定配置函数
        debug: true, //是否开启调试模式
        //flashplayer: true, //强制使用flashplayer
        drag: 'start', //拖动的属性
        seek: 0, //默认跳转的时间
        //playbackrate:1,//默认速度的编号，只对html5有效,设置成-1则不显示倍速
        //advertisements:'website:ad.json',
        //front:'frontFun',//上一集的操作函数
        //next:'nextFun',//下一集的操作函数
        video: [
            [videoResourceUrl, 'video/mp4', '中文标清', 0]
        ]
    };
    this.player = new ckplayer(this.videoObject);
}

MyCkPlayer.prototype.changeVideo = function(videoUrl) {
    if(this.player == null) {
        return;
    }

    var newVideoObject = {
        container: '#' + this.videoContainerId, //容器的ID
        variable: 'player',
        autoplay: true, //是否自动播放
        loaded: this.loadedHandler, //当播放器加载后执行的函数
        video: videoUrl
    }
    //判断是需要重新加载播放器还是直接换新地址

    if(this.player.playerType == 'html5video') {
        if(this.player.getFileExt(videoUrl) == '.flv' || this.player.getFileExt(videoUrl) == '.m3u8' || this.player.getFileExt(videoUrl) == '.f4v' || videoUrl.substr(0, 4) == 'rtmp') {
            this.player.removeChild();

            this.player = null;
            this.player = new ckplayer();
            this.player.embed(newVideoObject);
        } else {
            this.player.newVideo(newVideoObject);
        }
    } else {
        if(this.player.getFileExt(videoUrl) == '.mp4' || this.player.getFileExt(videoUrl) == '.webm' || this.player.getFileExt(videoUrl) == '.ogg') {
            this.player = null;
            this.player = new ckplayer();
            this.player.embed(newVideoObject);
        } else {
            this.player.newVideo(newVideoObject);
        }
    }
}

MyCkPlayer.prototype.getCkPlayer = function()
{
    return this.player;
}

MyCkPlayer.prototype.getProgressTime = function()
{
    return this.player.time;
}

/**
MyCkPlayer.prototype.loadedHandler = function(arg){//播放器加载后会调用该函数
    //console.log(arg);
    this.player.addListener('time', this.timeHandler); //监听播放时间,addListener是监听函数，需要传递二个参数，'time'是监听属性，这里是监听时间，timeHandler是监听接受的函数
}
MyCkPlayer.prototype.timeHandler = function(t){
    this.progressTime = t;
    console.log('当前播放的时间：'+this.progressTime);
}
*/